package com.dycong.common.json;

import com.alibaba.fastjson.serializer.FieldSerializer;
import com.alibaba.fastjson.serializer.JavaBeanSerializer;
import com.alibaba.fastjson.util.FieldInfo;

public class EnumSerializer extends JavaBeanSerializer{

	public EnumSerializer(Class<?> clazz) {
		super(clazz);
	}
	
	@Override
	public FieldSerializer createFieldSerializer(FieldInfo fieldInfo) {
		Class<?> clazz = fieldInfo.getFieldClass();
        if (clazz.getSuperclass() == Enum.class) {
            return new EnumFieldSerializer(fieldInfo);
        }
		return super.createFieldSerializer(fieldInfo);
	}
}
